package com.qf.agro.service.crop.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.agro.mapper.crop.SaAgroRelayMapper;
import com.qf.agro.pojo.crop.SaAgroRelay;
import com.qf.agro.service.crop.SaAgroRelayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: 六六六
 * @create: 2023-07-06 11:46
 **/
@Service
public class SaAgroRelayServiceImpl implements SaAgroRelayService {
    @Autowired
    private SaAgroRelayMapper saAgroRelayMapper;

    @Override
    public Page<SaAgroRelay> findPage(int pageNum, int pageSize,String name) {
        Page<SaAgroRelay> page=new Page<>(pageNum,pageSize);
            LambdaQueryWrapper<SaAgroRelay> queryWrapper=new LambdaQueryWrapper<>();
            queryWrapper.like(name!=null,SaAgroRelay::getRelayName,name);
        page = saAgroRelayMapper.selectPage(page, queryWrapper);

        return page;
    }

    @Override
    public void save(SaAgroRelay saAgroRelay) {
        saAgroRelayMapper.insert(saAgroRelay);
    }
}
